//
//  HRZMyOrderTitleCell.m
//  EMarket
//
//  Created by 石头 on 2018/5/23.
//  Copyright © 2018 好日子. All rights reserved.
//

#import "HRZMyOrderTitleCell.h"

@interface HRZMyOrderTitleCell()

@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UIView *symbolView;

@end

@implementation HRZMyOrderTitleCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        [self addSubview:self.titleLabel];
        
        [self addSubview:self.symbolView];
    }
    return self;
}



- (void)layoutSubviews {
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self);
    }];
    
    [self.symbolView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(self.titleLabel);
        make.bottom.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(self.width * 0.7, 2));

    }];
}

- (void)setSelected:(BOOL)selected {
    if (selected) {
        _symbolView.hidden = NO;
        _symbolView.backgroundColor = HRZThemeColor;
        _titleLabel.textColor = HRZThemeColor;
    } else {
        _symbolView.hidden = YES;
        _titleLabel.textColor = [UIColor blackColor];
    }
}

- (void)setTitleName:(NSString *)titleName {
    _titleName = titleName;
    
    self.titleLabel.text = _titleName;
}

#pragma mark - ----  getter/setter  ----
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.frame = CGRectMake(0, 0, 80, 40);
    }
    return _titleLabel;
}

- (UIView *)symbolView {
    if (!_symbolView) {
        _symbolView = [[UIView alloc] init];
        _symbolView.frame = CGRectMake(0, 0, 30, 2);
        _symbolView.backgroundColor = [UIColor redColor];
        _symbolView.hidden = YES;
    }
    return _symbolView;
}


@end
